package com.third.clock;

import android.app.Application;
import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;

import com.lzy.okgo.OkGo;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;
import com.third.clock.manager.BuglyManager;
import com.third.clock.manager.UmengManager;
import com.third.clock.service.ClockService;
import com.third.clock.service.JobHandlerService;
import com.third.clock.service.RemoteService;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.MsgConstant;
import com.umeng.message.PushAgent;
import com.umeng.message.UTrack;
import com.umeng.message.UmengMessageHandler;
import com.umeng.message.UmengNotificationClickHandler;
import com.umeng.message.entity.UMessage;

/**
 * Created by Administrator on 2018/7/21 0021.
 */

public class ClockApplication extends Application{
    @Override
    public void onCreate() {
        super.onCreate();
        //友盟初始化必须放在这里初始化，不然会推送的消息接收不到
        UmengManager.getInstance(ClockApplication.this).onCreate();
        BuglyManager.getInstance(ClockApplication.this).onCreate();
        initOkGo();

        startService(new Intent(ClockApplication.this, ClockService.class));
        startService(new Intent(ClockApplication.this, RemoteService.class));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            startService(new Intent(ClockApplication.this, JobHandlerService.class));
        }

        initLog();

    }

    private void initLog(){
        Logger.addLogAdapter(new AndroidLogAdapter());
    }

    private void initOkGo(){
        //必须调用初始化
        OkGo.getInstance().init(ClockApplication.this);
    }

}
